package org.xwalk.core.internal;

import android.graphics.Bitmap;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class XWalkGetBitmapCallbackBridge extends XWalkGetBitmapCallbackInternal {
    private XWalkCoreBridge coreBridge;
    private Object wrapper;

    public Object getWrapper() {
        return wrapper;
    }



    public XWalkGetBitmapCallbackBridge(Object wrapper) {
        super();

        this.wrapper = wrapper;
        reflectionInit();
    }

        @Override
    public void onFinishGetBitmap(Bitmap bitmap, int response) {
        onFinishGetBitmapBitmapintMethod.invoke(bitmap, response);
    }


    private ReflectMethod onFinishGetBitmapBitmapintMethod = new ReflectMethod(null, "onFinishGetBitmap");


    void reflectionInit() {
        coreBridge = XWalkCoreBridge.getInstance();
        if (coreBridge == null) return;

        onFinishGetBitmapBitmapintMethod.init(wrapper, null,
                "onFinishGetBitmap", Bitmap.class, int.class);
    }
}
